package com.viknix.threadpool.manager.cluster.listener;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @Author: Dongqi
 * @Date: 2021/11/11 13:40
 * @Version 1.0
 * @Description: 项目监听器 {@link TpmSpringApplicationRunListener}
 */
public interface TpmApplicationListener {

    /**
     * {@link TpmSpringApplicationRunListener#starting}.
     */
    void starting();

    /**
     * {@link TpmSpringApplicationRunListener#environmentPrepared}.
     *
     * @param environment environment
     */
    void environmentPrepared(ConfigurableEnvironment environment);

    /**
     * {@link TpmSpringApplicationRunListener#contextLoaded}.
     *
     * @param context context
     */
    void contextPrepared(ConfigurableApplicationContext context);

    /**
     * {@link TpmSpringApplicationRunListener#contextLoaded}.
     *
     * @param context context
     */
    void contextLoaded(ConfigurableApplicationContext context);

    /**
     * {@link TpmSpringApplicationRunListener#started}.
     *
     * @param context context
     */
    void started(ConfigurableApplicationContext context);

    /**
     * {@link TpmSpringApplicationRunListener#running}.
     *
     * @param context context
     */
    void running(ConfigurableApplicationContext context);

    /**
     * {@link TpmSpringApplicationRunListener#failed}.
     *
     * @param context   context
     * @param exception exception
     */
    void failed(ConfigurableApplicationContext context, Throwable exception);
}
